package cn.tedu.pdfamily.product.security;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * 用户信息详情类，是Spring Security框架的loadUserByUsername()的返回结果
 *
 * @author java@tedu.cn
 * @version 0.0.1
 */
@Setter
@Getter
@ToString(callSuper = true)
@EqualsAndHashCode
public class UserDetail extends User {

    private Long id;

    public UserDetail(Long id,
                      String username,
                      String password,
                      boolean enabled,
                      Collection<? extends GrantedAuthority> authorities) {
        super(username, password, enabled, true,
                true, true, authorities);
        this.id = id;
    }

}
